import 'package:fish_redux/fish_redux.dart';

import 'action.dart';
import 'state.dart';

Reducer<InstallViewState> buildReducer() {
  return asReducer(
    <Object, Reducer<InstallViewState>>{
      InstallViewAction.action: _onAction,
      InstallViewAction.setOrderPhoto: _setOrderPhoto,
    },
  );
}

InstallViewState _onAction(InstallViewState state, Action action) {
  final InstallViewState newState = state.clone();
  return newState;
}

InstallViewState _setOrderPhoto(InstallViewState state, Action action) {
  final InstallViewState newState = state.clone();
  newState.orderPhoto.add(action.payload);
  return newState;
}